<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=9" />
        <title> Automats </title>
        <link href="<?echo base_url();?>css/common.css" rel="stylesheet" type="text/css"/>
        <link href="<?echo base_url();?>css/ui/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css"/>
        <link href="<?echo base_url();?>css/new_automat_view.css" rel="stylesheet" type="text/css"/>
        <script src="<?echo base_url();?>jscripts/new_automat_list_view.js" type="text/javascript"></script>
        <script src="<?echo base_url();?>jscripts/jquery-1.7.js" type="text/javascript"></script>
        <script src="<?echo base_url();?>jscripts/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
        <script>
            window.onload = function(){
                var data = {
                    detailsUrl : "<?echo base_url();?>automat/getAutomateDetails",
                    getWaresTableUrl : "<?echo base_url();?>Ware/GetWaresTable",
                    getLogTableUrl : "<?echo base_url();?>Automat/GetAutomatLog"
                };
                AutomatListView.init(data);
            }
        </script>
    </head>
    
    <body>
        <div id="carrier">
	<?
	include("application/views/blocks/login_menu.php");
	include("application/views/blocks/header.php");
	include("application/views/blocks/main_menu.php");
	?>
	<br/>
        <div id="content">
			<div id="blocks">
            <?
                foreach($automates as $a){
                    //AutomatId,ConnectTime,Latitude,Longitude,IP,UserId,Balance,Serviceability,Info
                    $stateText = "YES";
                    $stateClass = "text-yes";
                    if($a['Serviceability'] == 0){
                        $stateText = "NO";
                        $stateClass = "text-no";
                    }
                     
                    echo"<div class='automate-info-block'>
                            <input type='hidden' value='".$a['AutomatId']."'/>
                            <div class='block-header'>
                                ID: ".$a['AutomatId']."
                            </div>
                            <div class='automate-info'>
                                Info: ".$a['Info']."
                            </div>
                            Balance: ".$a['Balance']."<br/>
                            Connect time: ".$a['ConnectTime']."<br/>
                            Latitude: ".$a['Latitude']."<br/>
                            Longitude: ".$a['Longitude']."<br/>
                            IP: ".$a['IP']."<br/>
                            <div class='".$stateClass."'>
                                Serviceability: ".$stateText."
                            </div>
                        </div>";
                }
            ?>
			</div>
        </div>
        <?
            include("blocks/footer.php");
        ?>
        </div>
    </body>
</html>